function ajax(url, callback) {
    let xmlhttp
    
if (window.XMLHttpRequest) { 
    xmlhttp = new XMLHttpRequest()
    } else { // code for IE6, IE5
    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
    }
    // 发送请求
    xmlhttp.open("GET", url, true)
    xmlhttp.send()
    // 服务端响应
    xmlhttp.onreadystatechange = function() {
    if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
 let obj = JSON.parse(xmlhttp.responseText)
    console.log(obj)
    }


    if(xmlhttp.readyState === 4  && xmlhttp.status === 200){
    console.log(xmlhttp.readyState,xmlhttp.status)}
    else{
        
    }
    
}
}



let p = new Promise((resolve,reject)=>{
     ajax('../static/a.json',res=>{
        resolve(res)
     },err=>{
        reject(err)
     })
})

console.log(p)


p.then(data=>{
    console.log(data)
},err=>{
    console.log(err)
})
ajax('../static/a.json')
